/**
 * @filename:SysRoleServiceImpl 2022年1月27日
 * @project Wonder wallet Framework  V1.0
 * Copyright(c) 2018 LuZhongren Co. Ltd. 
 * All right reserved. 
 */
package com.wonder.admin.service.impl;

import com.wonder.admin.domain.SysRole;
import com.wonder.admin.mapper.SysRoleDao;
import com.wonder.admin.service.SysRoleService;
import com.wonder.admin.request.SysRoleRequest;


import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;


/**   
 * @Description:TODO(分组权限管理服务实现)
 *
 * @version: V1.0
 * @author: LuZhongren
 * 
 */
@Service
public class SysRoleServiceImpl  extends ServiceImpl<SysRoleDao, SysRole> implements SysRoleService  {

   /**
     * 修改分组权限管理信息
     * 
     * @param SysRole信息
     * @return 结果
     */
    @Override
    public int updateEx(SysRole sysRole){
       if(sysRole!=null)
		     return this.baseMapper.updateById(sysRole);
       return 0;
    }
    
    
    /**
	 * Description:分组权限管理分页返回
	 * @request:检索条件
	 * @page：分页参数
	 * @return:分页记录
	 */
	@Override 
	public IPage<SysRole> selectList(SysRoleRequest request, Page<SysRole> page){
	    LambdaQueryWrapper<SysRole> lambdaQueryWrapper = new LambdaQueryWrapper<>();
             
        if (StringUtils.hasText(request.getName())) {
			lambdaQueryWrapper.like(SysRole::getName, request.getName());
		} 
	    if (null != request.getStatus()) {
	       lambdaQueryWrapper.eq(SysRole::getStatus, request.getStatus());
	      }               
        
		lambdaQueryWrapper.orderByDesc(SysRole::getRole_id);	
		Page<SysRole> selectPage = this.baseMapper.selectPage(page, lambdaQueryWrapper);

		return selectPage;
    }
	
	
	
    
	
}